package com.asialjim.wechat.aes;

import java.util.ArrayList;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: ByteGroup ]</i> </h2><strong>
 * <p> byte group
 * </strong><p><p>Copyright &copy; Asial Jim Co., LTD<hr/>
 * @author Asial Jim &nbsp;&nbsp; <span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
 * @since 2021/1/27 20:53   &nbsp;&nbsp; JDK 8
 * @version 1.0.0
 */
class ByteGroup {
	ArrayList<Byte> byteContainer = new ArrayList<Byte>();

	public byte[] toBytes() {
		byte[] bytes = new byte[byteContainer.size()];
		for (int i = 0; i < byteContainer.size(); i++) {
			bytes[i] = byteContainer.get(i);
		}
		return bytes;
	}

	public ByteGroup addBytes(byte[] bytes) {
		for (byte b : bytes) {
			byteContainer.add(b);
		}
		return this;
	}

	public int size() {
		return byteContainer.size();
	}
}
